import { ref } from 'vue';

export const reload = ref<boolean>(false);

export const hasChildren = (list: Array<any>) => {
  list.forEach((item) => {
    if (item.hasChildren) {
      item.children = [];
    }
  });
  return list;
};

export const buildDepts = (depts) => {
  depts.forEach((data) => {
    if (data.children) {
      buildDepts(data.children);
    }
    if (data.leaf) {
      data.isLeaf = data.leaf;
    }
  });
};
